package com.surface.hao.util;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @Description: 日志异常信息
 * @Author: songhao
 * @Email:425008064@qq.com
 * @CreateDate: 2019/12/30 14:39
 */
public class LogUtils {


    /**
     * 获取堆栈的异常信息
     * @param e
     * @return
     */
    public static String toStackTrace(Exception e) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        try {
            e.printStackTrace(pw);
            return sw.toString();
        } catch(Exception e1){
            return "";
        }
    }
}
